{% extends 'layout.html' %}

{% block content %}
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">{{ title }}</h3>
            </div>
            <div class="panel-body">
                {# 表单内容 #}
                <form method="post" enctype="multipart/form-data" novalidate>{# novalidate:不让浏览器作校验 #}

                    {% csrf_token %}{# post请求一定加这句 #}

                    {% for field in form %}
                        <div class="form-group">
                            <label>{{ field.label }}{# 取得名称 #}
                                {# 名后面接错误信息 #}
                                <span style="color:red;font-size:10px">{{ field.errors.0 }}</span>
                            </label>
                            {{ field }}{# 输入框内容 #}

                            {#<span style="color:red;">{{ field.errors.0 }}</span>#}
                        </div>
                    {% endfor %}

                    <button type="submit" class="btn btn-primary">提 交</button>
                </form>
            </div>
        </div>

    </div>
{% endblock %}